cc.Class({
    extends: cc.Component,

    properties: {
       loadBar: cc.Sprite,
       loadHead: cc.Node
    },

    onLoad () {
        GLOBAL.WIN_WIDTH = this.node.width;
        GLOBAL.WIN_HEIGHT = this.node.height; 
        
        var loadCount = 0;
        cc.loader.onProgress = (completedCount, totalCount, item) => {
            var percent = completedCount / totalCount;
            if (percent > loadCount) {
                this.loadBar.fillRange = loadCount = percent;
                this.loadHead.x = -361 + percent * 722;
                this.loadHead.rotation = -360 + percent * 720;
            }
        };
        cc.director.loadScene('GameScene');
    },

});
